package cn.yunhe.util;

import com.alibaba.fastjson.JSON;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class JasonUtil {

    public static void getJson(HttpServletResponse response,Object object){
        response.setContentType("text/html;charset=UTF-8");
        response.setHeader("Pragma","No-cache");
        response.setHeader("Cache-control","no-cache");
        response.setDateHeader("Expires",10);
        PrintWriter out = null;
        try {
            out = response.getWriter();
        } catch (IOException e) {
            e.printStackTrace();
        }

        String Json = JSON.toJSONString(object);
        out.print(Json);
        out.flush();
    }

}
